package com.springinaction.springidol;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 看看这个最基本的,其实这是学习Spring的入口
 * 依赖注入
 * @time 2014年11月25日10:11:31
 * @author xupeng
 *
 */
public class Test {

	@SuppressWarnings("resource")
	public static void main(String[] args) throws PerformanceException {
		ApplicationContext ctx = new ClassPathXmlApplicationContext("spring/spring-idol.xml");
		
		//Performer performer = (Performer)ctx.getBean("duke");
		//performer.perform();
		//------------------------------------------------
		//Performer performer1 = (Performer)ctx.getBean("duke1");
		//performer1.perform();
		//------------------------------------------------
		//其实,左边新建了一个对象,然后再根据配置文件传递
		//Jugger jugger = (Jugger)ctx.getBean("poeticDuke");
		//jugger.perform();
		
		//Performer kenny = (Performer)ctx.getBean("kenny");
		//kenny.perform();
		
		//通过切面引入新功能
		 Contestant eddie = (Contestant) ctx.getBean("duke");
		 eddie.receiveAward();
	}

}
